package com.tenbent.product.center.insures.dto;

import com.tenbent.product.base.dto.BaseDto;
import com.tenbent.product.center.insures.bo.SafeguardCategoryType;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 保障项目大类型
 *
 * @author Randy
 * 
 *         Created by ThinkPad on 2017/8/21.
 */
public class SafeguardCategoryTypeDto extends BaseDto {

	/** 产品ID **/
	@NotNull(message = "{product.id.not.empty}")
	private Integer productId;

	/** 类型代码 **/
	@NotEmpty(message = "{safeguard.category.type.code.not.empty}")
	private String typeCode;

	/** 类型名称 **/
	@NotEmpty(message = "{safeguard.category.type.name.not.empty}")
	private String typeName;

	// ==============以下为业务属性===============================//
	/** 产品保障小类 */
	// @JsonInclude(JsonInclude.Include.NON_NULL)
	// 此处可以不用配置，因为配置了全局mappingJackson2HttpMessageConverter
	private List<SafeguardCategoryDto> safeguardCategorys;

	public SafeguardCategoryTypeDto() {

	}

	public SafeguardCategoryTypeDto(SafeguardCategoryType safeguardCategoryType) {
		super(safeguardCategoryType);
		setProductId(safeguardCategoryType.getProductId());
		setTypeCode(safeguardCategoryType.getTypeCode());
		setTypeName(safeguardCategoryType.getTypeName());
	}

	public SafeguardCategoryType transToBo() {
		SafeguardCategoryType safeguardCategoryType = new SafeguardCategoryType();
		super.transToBo(safeguardCategoryType);
		safeguardCategoryType.setProductId(this.getProductId());
		safeguardCategoryType.setTypeCode(this.getTypeCode());
		safeguardCategoryType.setTypeName(this.getTypeName());
		return safeguardCategoryType;
	}

	public Integer getProductId() {
		return productId;
	}

	public void setProductId(Integer productId) {
		this.productId = productId;
	}

	public String getTypeCode() {
		return typeCode;
	}

	public void setTypeCode(String typeCode) {
		this.typeCode = typeCode;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public List<SafeguardCategoryDto> getSafeguardCategorys() {
		return safeguardCategorys;
	}

	public void setSafeguardCategorys(List<SafeguardCategoryDto> safeguardCategorys) {
		this.safeguardCategorys = safeguardCategorys;
	}
}
